x86: Print source of e820 memory map during boot. Fix Xen-e801 memmap
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Thu, 7 Jun 2007 19:02:27 +0000 (20:02 +0100)
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Thu, 7 Jun 2007 19:02:27 +0000 (20:02 +0100)
parsing. Get rid of unneeded e820_raw variable -- map straight onto
boot-trampoline e820 array.
Signed-off-by: Keir Fraser <keir@xensource.com>
xen/arch/x86/boot/mem.S
xen/arch/x86/e820.c
xen/arch/x86/setup.c
xen/include/asm-x86/e820.h

index ec4169540d6ef11312539104e8fe70e581334add..646462053db8413de93e9ad12d6dbe48f218ae60 100644 (file)
@@ -71,7 +71,7 @@ get_memory_map:
 e820map:
         .fill   E820MAX*20,1,0
 e820nr:
-        .byte   0
+        .long   0
 lowmem_kb:
         .long   0
 highmem_kb:
index 95daf54302b48a7d8ecb39aba0ed61ac9bd7b9ed..652d4e00425c4fd4b0a1aeb2ee474f2feb631c1e 100644 (file)
@@ -412,10 +412,11 @@ static void __init machine_specific_memory_setup(
     clip_mem();
 }
 
-unsigned long __init init_e820(struct e820entry *raw, int *raw_nr)
+unsigned long __init init_e820(
+    const char *str, struct e820entry *raw, int *raw_nr)
 {
     machine_specific_memory_setup(raw, raw_nr);
-    printk(KERN_INFO "Physical RAM map:\n");
+    printk(KERN_INFO "%s RAM map:\n", str);
     print_e820_memory_map(e820.map, e820.nr_map);
     return find_max_pfn();
 }
index 938388d26723e935171bd6019e7fbd3bdc54498e..cf3d5250dc816175ab5808f50c099a8449218606 100644 (file)
@@ -162,8 +162,6 @@ static void __init do_initcalls(void)
     for ( ; ; ) __asm__ __volatile__ ( "hlt" ); \
 } while (0)
 
-static struct e820entry __initdata e820_raw[E820MAX];
-
 static unsigned long __initdata initial_images_start, initial_images_end;
 
 unsigned long __init initial_images_nrpages(void)
@@ -338,6 +336,7 @@ void init_done(void)
 
 void __init __start_xen(multiboot_info_t *mbi)
 {
+    char *memmap_type = NULL;
     char __cmdline[] = "", *cmdline = __cmdline;
     unsigned long _initrd_start = 0, _initrd_len = 0;
     unsigned int initrdidx = 1;
@@ -345,7 +344,7 @@ void __init __start_xen(multiboot_info_t *mbi)
     unsigned long _policy_len = 0;
     module_t *mod = (module_t *)__va(mbi->mods_addr);
     unsigned long nr_pages, modules_length;
-    int i, e820_warn = 0, e820_raw_nr = 0, bytes = 0;
+    int i, e820_warn = 0, bytes = 0;
     struct ns16550_defaults ns16550 = {
         .data_bits = 8,
         .parity    = 'n',
@@ -395,23 +394,24 @@ void __init __start_xen(multiboot_info_t *mbi)
     if ( opt_xenheap_megabytes > 2048 )
         opt_xenheap_megabytes = 2048;
 
-    if ( bootsym(e820nr) != 0 )
+    if ( e820_raw_nr != 0 )
     {
-        e820_raw_nr = bootsym(e820nr);
-        memcpy(e820_raw, bootsym(e820map), e820_raw_nr * sizeof(e820_raw[0]));
+        memmap_type = "Xen-e820";
     }
-    else if ( lowmem_kb )
+    else if ( bootsym(lowmem_kb) )
     {
+        memmap_type = "Xen-e801";
         e820_raw[0].addr = 0;
-        e820_raw[0].size = lowmem_kb << 10;
+        e820_raw[0].size = bootsym(lowmem_kb) << 10;
         e820_raw[0].type = E820_RAM;
         e820_raw[1].addr = 0x100000;
-        e820_raw[1].size = highmem_kb << 10;
+        e820_raw[1].size = bootsym(highmem_kb) << 10;
         e820_raw[1].type = E820_RAM;
         e820_raw_nr = 2;
     }
     else if ( mbi->flags & MBI_MEMMAP )
     {
+        memmap_type = "Multiboot-e820";
         while ( bytes < mbi->mmap_length )
         {
             memory_map_t *map = __va(mbi->mmap_addr + bytes);
@@ -449,6 +449,7 @@ void __init __start_xen(multiboot_info_t *mbi)
     }
     else if ( mbi->flags & MBI_MEMLIMITS )
     {
+        memmap_type = "Multiboot-e801";
         e820_raw[0].addr = 0;
         e820_raw[0].size = mbi->mem_lower << 10;
         e820_raw[0].type = E820_RAM;
@@ -480,7 +481,7 @@ void __init __start_xen(multiboot_info_t *mbi)
     }
 
     /* Sanitise the raw E820 map to produce a final clean version. */
-    max_page = init_e820(e820_raw, &e820_raw_nr);
+    max_page = init_e820(memmap_type, e820_raw, &e820_raw_nr);
 
     /*
      * Create a temporary copy of the E820 map. Truncate it to above 16MB
index 19ef49eff2eb985c33f37a4d21a7516a1e836b1b..094aafce8225a37f3dbbe7bd29fd325a60b6e5c1 100644 (file)
@@ -10,12 +10,15 @@ struct e820map {
     struct e820entry map[E820MAX];
 };
 
-extern unsigned long init_e820(struct e820entry *, int *);
+extern unsigned long init_e820(const char *, struct e820entry *, int *);
 extern struct e820map e820;
 
 /* These symbols live in the boot trampoline. */
 extern struct e820entry e820map[];
-extern unsigned char e820nr;
+extern int e820nr;
 extern unsigned int lowmem_kb, highmem_kb;
 
+#define e820_raw bootsym(e820map)
+#define e820_raw_nr bootsym(e820nr)
+
 #endif /*__E820_HEADER*/